<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
	<script>var ctx="${ctx}";</script>
	<head>
	    <meta charset="utf-8">
	    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	    <title>支付页面管理</title>
	    <meta name="keywords" content="体验,友好,高级管理台,易用,高性能,高扩展性,bootstrap框架,响应式后台">
	    <meta name="description" content="这是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
	    <meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
		<meta http-equiv="expires" content="Wed, 26 Feb 209908:21:57 GMT"> 
	    
		<link rel="shortcut icon" href="favicon.ico"> 
		<link href="${ctx}/static/css/bootstrap.min.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/font-awesome.min.css?v=4.4.0?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/footable/footable.core.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/summernote/summernote.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/summernote/summernote-bs3.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/plugins/laypage/laypage.css?v=${static_version}"  rel="stylesheet">
		<link href="${ctx}/static/css/plugins/iCheck/custom.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/chosen/chosen.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/animate.min.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/js/plugins/layer/laydate/laydate.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/plugins/webuploader/webuploader.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/css/style.min.css?v=${static_version}/" rel="stylesheet">
		<link href="${ctx}/static/js/plugins/fancybox/jquery.fancybox.css?v=${static_version}/" rel="stylesheet">
	    
	</head>
<body>
    <div class="row animated fadeInRight">
     <input type="hidden" id="token" name="token" value="<%=request.getAttribute("token") %>" />
     <div class="col-sm-12">
        <div class="panel-options">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">订单详细</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">订单日志</a></li>
                    </ul>
                    <div class="tab-content" >
		               <div id="tab-1" class="tab-pane active">
		                 <div class="wrapper wrapper-content">
		                    <div style="margin:0 auto;text-align: center;">
			      			  	 <perm:hasPermission code="order/send">
			      			  	 			<button onclick="sendOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne 1}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq 1}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-check"></i> 我要发货</button>
			      			  	 </perm:hasPermission>
								 <perm:hasPermission code="order/cancel"> 
					                        <button onclick="cancelOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne 0}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq 0}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-times"></i> 取消订单</button>
				      			  	 </perm:hasPermission>
				      			  	 <!-- 退货退款 -->
				      			  	 <c:if test="${order.status<0&&order.status>=-5 }">
				      			  	  <perm:hasPermission code="order/review"> 
					                        <button onclick="reviewOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne -1}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq -1}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-check"></i>同意退货</button>
				      			  	 </perm:hasPermission>
				      			  	  <perm:hasPermission code="order/review"> 
					                        <button onclick="rejectOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne -1}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq -1}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-times"></i>拒绝退货</button>
				      			  	 </perm:hasPermission>
				      			  	 <perm:hasPermission code="order/finish"> 
					                        <button onclick="finishOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne -3}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq -3}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-check"></i>退款完成</button>
				      			  	 </perm:hasPermission>
				      			  	 </c:if>
				      			  	 <!-- 未发货退款,未确认收货退款 -->
				      			  	 <c:if test="${(order.status==-6||order.status==-7||order.status==-8)&&(order.isargue==0)}">
				      			  	     <perm:hasPermission code="order/finish"> 
					                        <button onclick="returnPayOrder(this)" data-id="${order.id}" type="button" <c:if test="${(order.status ne -6)&&(order.status ne -7)}">class="btn btn-default button disabled"</c:if> <c:if test="${(order.status eq -6)||(order.status eq -7)}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-check"></i>退款完成</button>
				      			  	     </perm:hasPermission>
				      			  	 </c:if>
				      			  	 
				      			  	  <!-- 未确认收货商家提出争议 -->
				      			  	 <c:if test="${(order.status==-7||order.status==-8)&&(not empty order.shipDate)}">
				      			  	     <perm:hasPermission code="order/finish"> 
					                        <button onclick="argueOrder(this)" data-id="${order.id}" type="button" <c:if test="${(order.status ne -7)||(order.isargue eq 1)}">class="btn btn-default button disabled"</c:if> <c:if test="${(order.status eq -7)&&(order.isargue eq 0)}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-check"></i>提出争议</button>
				      			  	     </perm:hasPermission>
				      			  	 </c:if>
				      			  	 <!-- 平台同意退款拒绝退款 -->
				      			  	 <c:if test="${order.isargue==1}">
				      			  	  <perm:hasPermission code="order/argue"> 
					                        <button onclick="argueyesOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne -7}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq -7}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-check"></i>同意退款</button>
				      			  	       	<button onclick="arguenoOrder(this)" data-id="${order.id}" type="button" <c:if test="${order.status ne -7}">class="btn btn-default button disabled"</c:if> <c:if test="${order.status eq -7}">class="btn btn-primary btn-outline button"</c:if> ><i class="fa fa-times"></i>拒绝退款</button>
				      			  	   </perm:hasPermission> 
				      			  	 </c:if>
		                    </div><br><br>
		                    <div class="row">
		                      	<div class="col-sm-6">
		                              <dl class="dl-horizontal">
		                                  <dt>订单编号：</dt>
		                                  <dd><span class="label label-primary">${order.sn}</span>
		                                  </dd>
		                              </dl>
		                          </div>
		                          <div class="col-sm-6">
		                              <dl class="dl-horizontal">
		                                  <dt>订单状态：</dt>
		                                  <dd>
		                                  	<span class="label label-default">
		                                  	${order.order_status_name}
		                                  </dd>
		                              </dl>
		                          </div>
		                      </div>
		                      
		                      <div class="row">
		                          <div class="col-sm-6">
		                              <dl class="dl-horizontal">
		                                  <dt>订单总额：</dt>
		                                  <dd>${order.orderAmount}元</dd>
		                                  <dt>支付总额：</dt>
		                                  <dd>${order.payAmount}元</dd>
		                                  <dt>支付状态：</dt>
		                                  <dd>
		                                        <c:if test="${order.payStatus==0}">未支付</c:if>
		                                        <c:if test="${order.payStatus==1}">已支付</c:if>
		                                        <c:if test="${order.payStatus==2}">已退款</c:if>
		                                  </dd>
		                                  <dt>支付方式：</dt>
		                                  <dd>
		                                      <c:if test="${order.payType==0}">微信支付</c:if>
		                                      <c:if test="${order.payType==1}">支付宝支付</c:if>
		                                      <c:if test="${order.payType==2}">余额支付</c:if>
		                                  </dd>
		                                  <dt>支付编号：</dt>
		                                  <dd>${order.paySn}</dd>
		                              </dl>
		                          </div>
		                          <div class="col-sm-6" id="cluster_info">
		                              <dl class="dl-horizontal">
		                                  <dt>下单日期：</dt>
		                                  <dd><fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></dd>
		                                  <dt>发货状态：</dt>
		                                  <dd>
		                                    <c:if test="${order.shipDate eq null}">尚未发货</c:if><c:if test="${order.shipDate ne null}">已发货</c:if>
		                                  <dt>发货日期：</dt>
		                                  <dd><c:if test="${order.shipDate eq null}">尚未发货</c:if><c:if test="${order.shipDate ne null}">${order.shipDate}</c:if></dd>
		                                  <dt>评价状态：</dt>
		                                  <dd><c:if test="${order.cancomm eq 0}">未评价</c:if><c:if test="${order.cancomm eq 1}">已评价</c:if></dd>
		                              </dl>
		                          </div>
		                      </div>
	                           
	                           
	                           <div class="table-responsive m-t well" >
	                                                                                        商品信息:                                                        
				                        <table class="table invoice-table" style="font-size: 13px;margin-bottom: 0px">
				                            <thead>
				                                <tr>
				                                    <th>商品名称</th>
				                                    <th>商品编号</th>
				                                    <th>商品规格</th>
				                                    <th>商品数量</th>
				                                    <th>商品单价</th>
				                                    <th>商品总额</th>
				                                </tr>
				                            </thead>
				                            <tbody>
				                                <tr>
				                                    <td>${order.goodsName}</td>
				                                    <td>${order.productSn}</td>
				                                    <td>${order.specs}</td>
				                                    <td>${order.goodsNum}</td>
				                                    <td>${order.price}</td>
				                                    <td>${order.goodsNum*order.price}</td>
				                                </tr>
				                            </tbody>
				                        </table>
				                 </div> 
				                 
				                  <div class="table-responsive m-t well" >
	                                                                                        会员信息:                                                        
				                        <table class="table invoice-table" style="font-size: 13px;margin-bottom: 0px">
				                            <thead>
				                                <tr>
				                                    <th>会员昵称</th>
				                                    <th>真实姓名</th>
				                                    <th>手机号</th>
				                                    <th>区域</th>
				                                    <th>注册时间</th>
				                                </tr>
				                            </thead>
				                            <tbody>
				                                <tr>
				                                    <td>${member.nickName}</td>
				                                    <td>${member.name}</td>
				                                    <td>${member.mobile}</td>
				                                    <td>${member.province}${member.city}${member.region }</td>
				                                    <td><fmt:formatDate value="${member.createDate}" pattern="yyyy-MM-dd"/></td>
				                                </tr>
				                            </tbody>
				                        </table>
				                 </div> 
				                 
				                 <div class="table-responsive m-t well" >
	                                                                                              收货人信息:
				                        <table class="table invoice-table" style="font-size: 13px;margin-bottom: 0px">
				                            <thead>
				                                <tr>
				                                    <th>收货人</th>
				                                    <th>收货人手机号</th>
				                                    <th>收货区域</th>
				                                    <th>详细地址</th>
				                                    <th>物流名称</th>
				                                    <th>物流单号</th>
				                                </tr>
				                            </thead>
				                            <tbody>
				                                <tr>
				                                    <td>${order.shipName}</td>
				                                    <td>${order.shipMobile}</td>
				                                    <td>${order.shipArea}</td>
				                                    <td>${order.shipAddr}</td>
				                                    <td>${order.shipType}</td>
				                                    <td>${order.shipSn}</td>
				                                </tr>
				                            </tbody>
				                        </table>
				                 </div> 
				                 
				                  <c:if test="${(order.status<0)&&(not empty returns) }">
				                  <div class="table-responsive m-t well" >
	                                                                                              退款退货信息:
				                        <table class="table invoice-table" style="font-size: 13px;margin-bottom: 0px">
				                            <thead>
				                                <tr>
				                                    <th>类型</th>
				                                    <th>退货数量</th>
				                                    <th>退货金额</th>
				                                    <th style="width: 30%">申请理由</th>
				                                    <th>申请图片</th>
				                                    <th>退回物流名称</th>
				                                    <th>退回物流单号</th>
				                                    <c:if test="${order.status==-5||order.status==-9}"><th>拒绝理由</th></c:if>
				                                </tr>
				                            </thead>
				                            <tbody>
				                                <tr>
				                                    <td><c:if test="${returns.type==0 }">仅退款（未发货）</c:if>
				                                        <c:if test="${returns.type==1 }">仅退款（已发货）</c:if>
				                                        <c:if test="${returns.type==2 }">退货退款</c:if></td>
				                                    <td>${returns.num}</td>
				                                    <td>${returns.num*order.price}</td>
				                                    <td>${returns.reason}</td>
				                                    <td><c:if test="${not empty(returns.images)}">
														<c:forEach items="${fn:split(returns.images,',')}" var="i">
															<img src="${i}" style="width: 60px;height: 60px">
														</c:forEach>
														</c:if>
													</td>
				                                    <td>${returns.shipType}</td>
				                                    <td>${returns.shipSn}</td>
				                                    <c:if test="${order.status==-5||order.status==-9}"><td>${returns.refuseResaon }</td></c:if>
				                                </tr>
				                            </tbody>
				                        </table>
				                 </div> 
				                 </c:if>
				                    
				                    <div class="well m-t">
				                    <strong>订单备注：</strong> ${order.remark }<br><br>
				                    <strong>发票抬头：</strong> ${order.receiptTitle }<br><br>
				                     <strong>发票内容：</strong> ${order.receiptContent }<br><br>
				                     <c:if test="${order.isargue==1 }">
				                      <strong>商家争议理由：</strong> ${order.arguement }
				                      </c:if>
				                    </div>            
		          	     </div>
		                         
		               </div>
		            <div id="tab-2" class="tab-pane">
		                 <div id="vertical-timeline" class="vertical-container light-timeline">
                            		<c:forEach items="${logs }" var="log" varStatus="status">
                            			<div class="vertical-timeline-block">
	                                        <div class="vertical-timeline-icon <c:if test='${status.index==0 }'>navy-bg</c:if><c:if test='${status.index!=0 }'>gray-bg</c:if>">
	                                            <i class="fa fa-volume-down"></i>
	                                        </div>
	                                        <div class="vertical-timeline-content">
	                                            <h2>${log.opName}</h2>
	                                            <p>${log.message }</p>
	                                            <span class="vertical-date">
	                                        		<small><fmt:formatDate value="${log.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/></small>
	                                    		</span>
	                                        </div>
	                                    </div>
                            		</c:forEach>
                              </div>
					 </div>
             </div>
         </div></div>
     </div>
		
		
		
	<!-- 发货 -->
    <div class="modal inmodal" id="senddiv" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content animated bounceInRight">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span></button>
                     <h2 class="modal-title" id="myModalLabel">填写物流信息</h2>
                </div>
                <div class="modal-body">
                            <form action="" method="post" class="form-horizontal">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">物流名称</label>
                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="shipType" id="shipType" placeholder="物流名称">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">物流编号</label>

                                <div class="col-sm-9">
                                    <input type="text" class="form-control" name="shipSn" id="shipSn" placeholder="物流编号">
                                </div>
                            </div>
                        </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="senddiv()">发货</button>
                </div>
            </div>
         </div>
    </div>
    
		
	<script src="${ctx}/static/js/jquery.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/bootstrap.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/footable/footable.all.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/validate/jquery.validate.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/validate/messages_zh.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/webuploader/webuploader.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/summernote/summernote.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/summernote/summernote-zh-CN.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/chosen/chosen.jquery.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/layer/laydate/laydate.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/iCheck/icheck.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/plugins/laypage/laypage.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/switchery/switchery.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/eModal.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/cookie.js?v=?v=${static_version}"></script>
	<script src="${ctx}/static/common/custom-datatable.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/content.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/contabs.min.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/fancybox/jquery.fancybox.js?v=${static_version}"></script>
	<script src="${ctx}/static/js/plugins/layer/layer.js?v=${static_version}"></script>
	<script src="${ctx}/static/common/common.js?v=${static_version}"></script>
	
	<script>
    $(document).ready(function(){$("#ibox-content").addClass("ibox-content");$("#vertical-timeline").removeClass("light-timeline");$("#vertical-timeline").addClass("dark-timeline");$(".fancybox").fancybox({openEffect:"none",closeEffect:"none"});});

	    var status=${order.status};
	    /*1，取消订单*/
		function cancelOrder(me) {
	    	if(status!=0) return;
	    	 $.confirm({
				    text:"确定要取消该订单吗?",
				    confirm: function() {
						if(status==0){
							$.ajax({  
		   	 					url:'${ctx}/order/cancel',  
		   	 					data:{
									id:$(me).data("id"),							
									status:4,							
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
		   	 						layer.msg('操作成功，该订单已作废！', {icon: 6});
									location.reload();
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					}  
		   	 			    }); 
						}else{
							 layer.msg('操作失败,订单状态错误！', {icon: 2});
						}
		             },
					 cancel: function() {
					        return true;
					 }
	        })
	    }
		/*2，点击发货*/
		var sendOrder=function(me){
			if(status!=1) return;
			if(status==1){
				$('#senddiv').modal('show')
			}
		}
		/*确定发货*/
		function senddiv(){
			$.ajax({  
				url:'${ctx}/order/send',  
				data:{
					id:"${order.id}",							
					status:2,							
					shipSn:$("#shipSn").val(),
					shipType:$("#shipType").val(),
					token:$("#token").val()
			    },   
				type: 'POST',
					dataType:'json',  
					success:function(response){
						if(response.code==0){
							$('#senddiv').modal('hide');
							layer.msg('操作成功，该订单已发货！', {icon: 6});
							location.reload();
						}else{
						    layer.msg('操作失败！', {icon: 2});
						}
					}  
			    }); 
		}
		/*3，同意退货*/
		function reviewOrder(me) {
			if(status!=-1) return;
			 $.confirm({
				    text:"你确定退货订单审核通过吗？",
				    confirm: function() {
						if(status==-1){
							$.ajax({  
		   	 					url:'${ctx}/order/review',  
		   	 					data:{
									id:$(me).data("id"),							
									status:-2,							
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
		   	 						  layer.msg('操作成功，等待用户退回商品！', {icon: 6});
									  location.reload();
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					}  
		   	 			    }); 
						}else{
							 layer.msg('操作失败，该订单状态错误！', {icon: 2});
						}
				    },
					 cancel: function() {
					        return true;
					 }
	        })
	    }
		/*4.拒绝退货*/
		function rejectOrder(me) {
			if(status==-1){
				layer.prompt({
					  formType: 2,
					  title: '拒绝原因，必须填写！'
					}, function(value){
							$.ajax({  
		   	 					url:'${ctx}/order/finish',  
		   	 					data:{
									id:$(me).data("id"),							
									status:-5,							
									refuseReason:value,
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
		   	 						   layer.msg('操作成功，退货被拒绝！', {icon: 6});
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					   location.reload();
		   	 					}  
		   	 			    }); 
					});
			}else{
				 parent.layer.msg('操作失败，该订单状态错误！', {icon: 2});
			}
		}
		/*5,退货退款完成*/
		function finishOrder(me) {
			if(status!=-3) return;
			 $.confirm({
				    text:"你确定已经收到退回商品，并给用户退余额吗？",
				    confirm: function() {
						if(status==-3){
							$.ajax({  
		   	 					url:'${ctx}/order/finish',  
		   	 					data:{
									id:$(me).data("id"),							
									status:-4,							
									payStatus:2,
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
			   	 						layer.msg('操作成功，退货完成！', {icon: 6});
										location.reload();
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					}  
		   	 			    }); 
						}else{
							 layer.msg('操作失败，该订单状态错误！', {icon: 2});
						}
					},
				 cancel: function() {
				        return true;
				 }
			})
			}
		
		/*6,未发货退款完成,已发货*/
		function returnPayOrder(me) {
			if(status!=-6&&status!=-7) return;
			 $.confirm({
				    text:"确定立即给用户退余额吗？",
				    confirm: function() {
						if(status==-6||status==-7){
							$.ajax({  
		   	 					url:'${ctx}/order/finish',  
		   	 					data:{
									id:$(me).data("id"),							
									status:-8,							
									payStatus:2,
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
			   	 						layer.msg('操作成功，退款完成！', {icon: 6});
										location.reload();
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					}  
		   	 			    }); 
						}else{
							 layer.msg('操作失败，该订单状态错误！', {icon: 2});
						}
					},
				 cancel: function() {
				        return true;
				 }
			})
			}
		/*7.未确认收货订单，提出争议*/
		function argueOrder(me) {
			if(status==-7){
				layer.prompt({
					  formType: 2,
					  title: '争议原因，必须填写！'
					}, function(value){
							$.ajax({  
		   	 					url:'${ctx}/order/finish',  
		   	 					data:{
									id:$(me).data("id"),							
									arguement:value,
									isargue:1,
									status:-7,
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
		   	 						   layer.msg('操作成功，争议已提交,等待平台处理！', {icon: 6});
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					   location.reload();
		   	 					}  
		   	 			    }); 
					});
			}else{
				 parent.layer.msg('操作失败，该订单状态错误！', {icon: 2});
			}
		}
		
		/*8.系统拒绝退款*/
		function arguenoOrder(me) {
			if(status==-7&&(${order.isargue}==1)){
				layer.prompt({
					  formType: 2,
					  title: '拒绝原因，必须填写！'
					}, function(value){
							$.ajax({  
		   	 					url:'${ctx}/order/finish',  
		   	 					data:{
									id:$(me).data("id"),							
									status:-9,							
									refuseReason:value,
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
		   	 						   layer.msg('操作成功，退款被拒绝！', {icon: 6});
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					   location.reload();
		   	 					}  
		   	 			    }); 
					});
			}else{
				 parent.layer.msg('操作失败，该订单状态错误！', {icon: 2});
			}
		}
		
		/*9,有争议系统退款完成*/
		function argueyesOrder(me) {
			if(status!=-7&&(${order.isargue}==1)) return;
			 $.confirm({
				    text:"确定立即给用户退余额吗？",
				    confirm: function() {
						if(status==-7){
							$.ajax({  
		   	 					url:'${ctx}/order/finish',  
		   	 					data:{
									id:$(me).data("id"),							
									status:-8,							
									payStatus:2,
									token:$("#token").val()
								},   
								type: 'POST',
		   	 					dataType:'json',  
		   	 					success:function(response){
		   	 						if(response.code==0){
			   	 						layer.msg('操作成功，退款完成！', {icon: 6});
										location.reload();
		   	 						}else{
		   	 						    layer.msg('操作失败！', {icon: 2});
		   	 						}
		   	 					}  
		   	 			    }); 
						}else{
							 layer.msg('操作失败，该订单状态错误！', {icon: 2});
						}
					},
				 cancel: function() {
				        return true;
				 }
			})
			}
	</script>
	</body>
</html>


